<?php class Eventshangar { 

    /***
     * DB Fields: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $id;

    /***
     * DB Fields: Time
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $Time;

    /***
     * DB Fields: EventName
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $EventName;

    /***
     * DB Fields: Type
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $Type;

    /***
     * DB Fields: UserId
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $UserId;

    /***
     * DB Fields: PlanetId
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $PlanetId;

    /***
     * DB Fields: elementType
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $elementType;

    /***
     * DB Fields: number
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $number;

    /***
     * DB Fields: spentM
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $spentM;

    /***
     * DB Fields: spentC
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $spentC;

    /***
     * DB Fields: spentD
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $spentD;

    /***
     * DB Fields: nextAt
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $nextAt;

//--------------- GET METHODS ----------------------------- //
    /***
     * Get value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result id
     **/
    function get_id( ) {
        // returns the value of id
        return $this->id;
    }


    /***
     * Get value for field: Time
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result Time
     **/
    function get_Time( ) {
        // returns the value of Time
        return $this->Time;
    }


    /***
     * Get value for field: EventName
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result EventName
     **/
    function get_EventName( ) {
        // returns the value of EventName
        return $this->EventName;
    }


    /***
     * Get value for field: Type
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result Type
     **/
    function get_Type( ) {
        // returns the value of Type
        return $this->Type;
    }


    /***
     * Get value for field: UserId
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result UserId
     **/
    function get_UserId( ) {
        // returns the value of UserId
        return $this->UserId;
    }


    /***
     * Get value for field: PlanetId
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result PlanetId
     **/
    function get_PlanetId( ) {
        // returns the value of PlanetId
        return $this->PlanetId;
    }


    /***
     * Get value for field: elementType
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result elementType
     **/
    function get_elementType( ) {
        // returns the value of elementType
        return $this->elementType;
    }


    /***
     * Get value for field: number
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result number
     **/
    function get_number( ) {
        // returns the value of number
        return $this->number;
    }


    /***
     * Get value for field: spentM
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result spentM
     **/
    function get_spentM( ) {
        // returns the value of spentM
        return $this->spentM;
    }


    /***
     * Get value for field: spentC
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result spentC
     **/
    function get_spentC( ) {
        // returns the value of spentC
        return $this->spentC;
    }


    /***
     * Get value for field: spentD
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result spentD
     **/
    function get_spentD( ) {
        // returns the value of spentD
        return $this->spentD;
    }


    /***
     * Get value for field: nextAt
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result nextAt
     **/
    function get_nextAt( ) {
        // returns the value of nextAt
        return $this->nextAt;
    }


//--------------- SET METHODS ----------------------------- //
    /***
     * Set value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function set_id( $id ) {
        // sets the value of id
        $this->id = $id;
    }

    /***
     * Set value for field: Time
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param Time
     * @result void
     **/
    function set_Time( $Time ) {
        // sets the value of Time
        $this->Time = $Time;
    }

    /***
     * Set value for field: EventName
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param EventName
     * @result void
     **/
    function set_EventName( $EventName ) {
        // sets the value of EventName
        $this->EventName = $EventName;
    }

    /***
     * Set value for field: Type
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param Type
     * @result void
     **/
    function set_Type( $Type ) {
        // sets the value of Type
        $this->Type = $Type;
    }

    /***
     * Set value for field: UserId
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param UserId
     * @result void
     **/
    function set_UserId( $UserId ) {
        // sets the value of UserId
        $this->UserId = $UserId;
    }

    /***
     * Set value for field: PlanetId
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param PlanetId
     * @result void
     **/
    function set_PlanetId( $PlanetId ) {
        // sets the value of PlanetId
        $this->PlanetId = $PlanetId;
    }

    /***
     * Set value for field: elementType
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param elementType
     * @result void
     **/
    function set_elementType( $elementType ) {
        // sets the value of elementType
        $this->elementType = $elementType;
    }

    /***
     * Set value for field: number
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param number
     * @result void
     **/
    function set_number( $number ) {
        // sets the value of number
        $this->number = $number;
    }

    /***
     * Set value for field: spentM
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param spentM
     * @result void
     **/
    function set_spentM( $spentM ) {
        // sets the value of spentM
        $this->spentM = $spentM;
    }

    /***
     * Set value for field: spentC
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param spentC
     * @result void
     **/
    function set_spentC( $spentC ) {
        // sets the value of spentC
        $this->spentC = $spentC;
    }

    /***
     * Set value for field: spentD
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param spentD
     * @result void
     **/
    function set_spentD( $spentD ) {
        // sets the value of spentD
        $this->spentD = $spentD;
    }

    /***
     * Set value for field: nextAt
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param nextAt
     * @result void
     **/
    function set_nextAt( $nextAt ) {
        // sets the value of nextAt
        $this->nextAt = $nextAt;
    }

//--------------- CRUD METHODS ----------------------------- //
    /***
     * Create a new Record: eventshangar
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param Time
     * @param EventName
     * @param Type
     * @param UserId
     * @param PlanetId
     * @param elementType
     * @param number
     * @param spentM
     * @param spentC
     * @param spentD
     * @param nextAt
     * @result void
     **/
    function createnew_eventshangar( $id, $Time, $EventName, $Type, $UserId, $PlanetId, $elementType, $number, $spentM, $spentC, $spentD, $nextAt ) {

        // items to be inserted in the database 
        $_obj = array($id,
                      $Time,
                      $EventName,
                      $Type,
                      $UserId,
                      $PlanetId,
                      $elementType,
                      $number,
                      $spentM,
                      $spentC,
                      $spentD,
                      $nextAt); 

        // database object connection
        $dbConn = $GLOBALS['dbConn'];

        // perform insert in the database
        $dbConn->insert("eventshangar", $_obj);
    }

    /***
     * Retrived an existing record: eventshangar
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result new Eventshangar
     **/
    function get_eventshangar( $id ) {

        // retrive the data
        $dbConn = $GLOBALS['dbConn'];

        // retrieved value in the database
        $_resultSet = $dbConn->doQuery("SELECT * FROM eventshangar WHERE id = '$id'");

        $__eventshangarObj = new eventshangar();
        // return the retrived from the database

        // create a new object
        $__obj = new Eventshangar();
        $__obj->set_id($_resultSet[0]['id']);
        $__obj->set_Time($_resultSet[0]['Time']);
        $__obj->set_EventName($_resultSet[0]['EventName']);
        $__obj->set_Type($_resultSet[0]['Type']);
        $__obj->set_UserId($_resultSet[0]['UserId']);
        $__obj->set_PlanetId($_resultSet[0]['PlanetId']);
        $__obj->set_elementType($_resultSet[0]['elementType']);
        $__obj->set_number($_resultSet[0]['number']);
        $__obj->set_spentM($_resultSet[0]['spentM']);
        $__obj->set_spentC($_resultSet[0]['spentC']);
        $__obj->set_spentD($_resultSet[0]['spentD']);
        $__obj->set_nextAt($_resultSet[0]['nextAt']);


        return $__obj;
    }

    /***
     * Update an existing record: eventshangar
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param itemsToBeUpdated = array()
     * @result void
     **/
    function update_eventshangar( $id, $itemsToBeUpdated = array() ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs update in the database
         foreach($itemsToBeUpdated as $_fName => $_fVal) { 
               $dbConn->addValuePair($_fName, $_fVal);
         }

         // perform update operation
         $dbConn->update("eventshangar", "id = '$id'");
    }

    /***
     * Delete an existing record: eventshangar
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function delete_eventshangar( $id ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs deletion of data
         $dbConn->delete("eventshangar", "id = '$id'");
    }

    /***
     * Retrived list of objects base on a given parameters: eventshangar
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param conditionalStatement = ''
     * @result collection of objects: Eventshangar
     **/
    function list_eventshangar( $conditionalStatement = '' ) {

         $dbConn = $GLOBALS['dbConn'];
         // check if there is a given parameter list
         if(!empty($conditionalStatement)) { 
              $sqlStatement = "SELECT * FROM eventshangar WHERE $conditionalStatement"; 
         } else { 
              $sqlStatement = "SELECT * FROM eventshangar";
         }

         // retrieve the values base on the query result
         $__resObj = $dbConn->doQuery($sqlStatement);

         $__collectionOfObjects = array();
         foreach($__resObj as $__rs) { 
            $__newObj = new Eventshangar();

            $__newObj->set_id($__rs['id']);
            $__newObj->set_Time($__rs['Time']);
            $__newObj->set_EventName($__rs['EventName']);
            $__newObj->set_Type($__rs['Type']);
            $__newObj->set_UserId($__rs['UserId']);
            $__newObj->set_PlanetId($__rs['PlanetId']);
            $__newObj->set_elementType($__rs['elementType']);
            $__newObj->set_number($__rs['number']);
            $__newObj->set_spentM($__rs['spentM']);
            $__newObj->set_spentC($__rs['spentC']);
            $__newObj->set_spentD($__rs['spentD']);
            $__newObj->set_nextAt($__rs['nextAt']);

            // add object to collection 
            array_push($__collectionOfObjects, $__newObj);
         }

         // return collection of objects
         return $__collectionOfObjects;
    }

} ?>